<script>
    var switchId,cbinetId;
    function nextPage(pageNo){
        $("#notification-listing").load("<?= $this->baseURI(); ?>marketing/myhouses/list/0/"+pageNo);
    }
    function addFile(cabinet_id,switch_id){
        switchId = switch_id;
        cbinetId = cabinet_id;
        $("#add-document-form").load("<?= $this->baseURI(); ?>marketing/myhouses/add/"+switchId);
        $("#add-document-form" ).dialog( "open" );
    }
    $(function() {
        $( "#dialog:ui-dialog" ).dialog( "destroy" );
        $( "#add-document-form" ).dialog({
            autoOpen: false,
            height: 300,
            width: 450,
            modal: true,
            buttons: {
                "Add": function() {
                    $('#document_form').submit();
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                    $('#add-document-form').html('');
                }
            },
            close: function() {
                $('#add-document-form').html('');
                //   allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });

    });
    function contract(houseId){
        
        $(function() {
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $("#contract-box" ).dialog( {resizable: false,width: 450, modal: true,
                buttons: {
                "Add": function() {
                    $('#contract_form').submit();
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                    $('#contract-box').html('');
                }
            } });
            $("#contract-box").load("<?= $this->baseURI(); ?>marketing/myhouses/contract/"+houseId);
        });
    }  
    function interaction(houseId){
        
        $(function() {
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $("#interaction-box" ).dialog( {resizable: false,width: 450, modal: true });
            $("#interaction-box").load("<?= $this->baseURI(); ?>marketing/myhouses/interaction/"+houseId);
        });
    }    
    function updateInteraction(interaction,houseId){
        inter = 0;
        id = $("#"+interaction);
        if(id.is(':checked') ){
            inter = 1;            
        }
        $.ajax({
            type: "POST",
            url: "<?= $this->baseURI(); ?>marketing/myhouses/updateinteraction/"+houseId,
            data: ({interactionNo : interaction,value:inter})            
        });
    }
</script>
<div class="dataBoxOver">
    <div class="dataInnRep">
        <div class="dataInnTop" id="notification-listing">
            <?php echo $this->render('myhouses/list.phtml'); ?>
        </div>
    </div>
</div>
<div id="add-document-form" ></div>
<div id="interaction-box" title="Interaction" ></div>
<div id="contract-box" title="Contract" ></div>